/**
 *	@project:	kybernetes
 *	@author:	D.Toepel
 *	@note:		---
 *	
 *	Copyright (C) 2009  D.Toepel <de.dtools> {at} <gmail> {dot} <com>
 *	
 *	This program is free software: you can redistribute it and/or modify
 *	it under the terms of the GNU General Public License as published by
 *	the Free Software Foundation, either version 3 of the License, or
 *	(at your option) any later version.
 *	
 *	This program is distributed in the hope that it will be useful,
 *	but WITHOUT ANY WARRANTY; without even the implied warranty of
 *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *	GNU General Public License for more details.
 *	
 *	You should have received a copy of the GNU General Public License
 *	along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *	
 */
package dt.htwk.res;

import java.awt.Color;
import java.io.File;
import java.net.*;

import javax.swing.*;

/**
 * Verwalten der Resourcen fuer Kybernetes 
 * @author daniel
 *
 */
public class Resource {
	
	private static String PNGPATH = "png/";
	private static String HTMPATH = "dt/htwk/res/htm/";
	
	
/* *******************************************
 * Farben definieren
 */
	
	/**
	 * Vorder- / Hintergundfarbe LightGray
	 */
	public final static Color tableGray = new Color(242,242,242);
	
	/**
	 * Vorder- / Hintergundfarbe LightGray
	 */
	public final static Color lightGray = new Color(230,230,230);
	
	/**
	 * Vorder- / Hintergundfarbe NimbusGray
	 */
	public final static Color nimbusGray = new Color(214,217,223);
	
	/**
	 * Vorder- / Hintergundfarbe SilverGray
	 */
	public final static Color silverGray = new Color(195,200,205);
	
	/**
	 * Vorder- / Hintergundfarbe DarkGray
	 */
	public final static Color darkGray = new Color(65,65,65);
	
	/**
	 * Vorder- / Hintergundfarbe DarkMarineBlue
	 */
	public final static Color darkMarineBlue = new Color(92,108,129); 
	
	/**
	 * Vorder- / Hintergundfarbe LightMarineBlue
	 */
	public final static Color lightMarineBlue = new Color(152,168,189); 
	
	/**
	 * Vorder- / Hintergundfarbe LightMarineBlue
	 */
	public final static Color white = new Color(255,255,255);
	
	/**
	 * Vorder- / Hintergundfarbe DarkRed
	 */
	public final static Color darkRed = new Color(210,108,92);

	/**
	 * Vorder- / Hintergundfarbe DarkRed
	 */
	public final static Color darkGreen = new Color(108,210,92);
	
	
/* *******************************************
 * Graphiken fuer Hauptprogramm laden
 */
	
	public final static ImageIcon regattaIcon = new ImageIcon(
    		Resource.class.getResource(PNGPATH + "regatta.jpg"));
	
	public final static ImageIcon windRose = new ImageIcon(
    		Resource.class.getResource(PNGPATH + "rose200.png"));
	
	public final static ImageIcon loadIcon = new ImageIcon(
    		Resource.class.getResource(PNGPATH + "load.png"));
	
	public final static ImageIcon exportIcon = new ImageIcon(
    		Resource.class.getResource(PNGPATH + "export.png"));
	
	public final static ImageIcon importIcon = new ImageIcon(
    		Resource.class.getResource(PNGPATH + "import.png"));
	
	public final static ImageIcon saveIcon = new ImageIcon(
    		Resource.class.getResource(PNGPATH + "save.png"));
	
	public final static ImageIcon saveAsIcon = new ImageIcon(
    		Resource.class.getResource(PNGPATH + "saveas.png"));
	
	public final static ImageIcon deleteIcon = new ImageIcon(
    		Resource.class.getResource(PNGPATH + "delete.png"));
	
	
/* *******************************************
 * Graphiken fuer Statusbar laden
 */
	public final static ImageIcon connectIcon = new ImageIcon(
    		Resource.class.getResource(PNGPATH + "connect.png"));	
	
	public final static ImageIcon disconnectIcon = new ImageIcon(
    		Resource.class.getResource(PNGPATH + "disconnect.png"));
	
	public final static ImageIcon disconnectAIcon = new ImageIcon(
    		Resource.class.getResource(PNGPATH + "disconnectA.png"));
	
	public final static ImageIcon disconnectBIcon = new ImageIcon(
    		Resource.class.getResource(PNGPATH + "disconnectB.png"));
		
		
/* *******************************************
 * URLs laden
 */
//	public final static URL getStartUrl(){
//		URL html = Resource.class.getResource(HTMPATH + "start.html");
//		return html;
//	}
	
/* *******************************************
 * Systempfade ermitteln
 */	
	public static String getWorkDir(){
		String workDir = System.getProperty("user.home");
		if (isWindows()) 
			workDir += File.separator + "Eigene Dateien";
		workDir += File.separator + "Kybernetes";
		
		File fWorkDir = new File(workDir);
		if (!fWorkDir.exists())
			fWorkDir.mkdir();
		
		return workDir;
	}
	
	public static String getCurrPath(){
		File dir1 = new File (".");
		String currPath = "";
	    try
	    {
	    	currPath = dir1.getCanonicalPath();
	    }
	    catch(Exception e) {e.printStackTrace();}
	    return currPath;
	}
	
	
/* *******************************************
 * Betriebssystem ermitteln
 */	
	public static boolean isWindows(){
		 
		String os = System.getProperty("os.name").toLowerCase();
		//windows
	    return (os.indexOf( "win" ) >= 0); 
 
	}
 
	public static boolean isMac(){
 
		String os = System.getProperty("os.name").toLowerCase();
		//Mac
	    return (os.indexOf( "mac" ) >= 0); 
 
	}
 
	public static boolean isUnix(){
 
		String os = System.getProperty("os.name").toLowerCase();
		//linux or unix
	    return (os.indexOf( "nix") >=0 || os.indexOf( "nux") >=0);
 
	}


}
